<?php 
	namespace Admin\Controller\User;
	use Think\Controller;
	class ScreenController extends Controller{
		public function index(){
			if(!empty(session('id')) || !empty(session('username'))){	
				if(!empty(session('id'))){
					$user = M('user');
					$data = $user->find(session('id'));
					session('id',null);
					$personal = M('personal')->where('uid = '.$data['id'])->find();
					session('username',$data['username']);
					session('name',$personal['name']);
					session('pic',$personal['pic']);
				}
				$this->display();
			}else{
				$this->success('没有登录,请登录',U('admin/user/login/index'));die;
			}
		}
		public function unlock(){
			$user = M('user');
			$where['username']=session('username');
			$where['password']=md5(I('post.password'));
			$res = $user->where($where)->find();
			if($res){
				session('id',$res['id']);
				echo 'yes';
			}else{
				echo 'no';
			}
		}
	}
?>